package com.example.s02_intent;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class OtherActivity extends Activity{

	private TextView textView;
	private EditText eText;
	private Button button;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.other);
		
		Intent intent = getIntent();
		int age = intent.getIntExtra("com.example.s02_intent.Age",10);
		textView = (TextView)findViewById(R.id.Text);
		textView.setText(age+"");
		eText = (EditText)findViewById(R.id.edittext);
		button = (Button)findViewById(R.id.button2);
		Buttonclick buttonclick = new Buttonclick();
		button.setOnClickListener(buttonclick);
		
	}
	
class Buttonclick implements OnClickListener{
	@Override
	public void onClick(View arg0) {
		Intent intent2 = new Intent();
		String st = eText.getText().toString();
		intent2.setClass(OtherActivity.this, MainActivity.class);
		intent2.putExtra("com.example.s02_intent.name", st);
		startActivity(intent2);
	}
}
}
